#ifndef __GAF_SYSINCDEF_LINUX_H__
#define __GAF_SYSINCDEF_LINUX_H__

#include <sys/types.h>
#include <dirent.h>
#include <stdio.h>

// 文件目录系统操作
#undef  SYS_FS_KIND_DIR
#define SYS_FS_KIND_DIR				DT_DIR
#undef  SYS_FS_KIND_FILE
#define SYS_FS_KIND_FILE			DT_REG
#undef  SYS_FS_ERROR
#define SYS_FS_ERROR				NULL

#undef  SYS_FS_DIR
#define SYS_FS_DIR				DIR*
#undef  SYS_FS_DATA
#define SYS_FS_DATA				struct dirent*

#undef  SYS_FS_OPEN
#define SYS_FS_OPEN(_szPath, _DIR, _DATA)	( (NULL == (_DIR = opendir(_szPath))) ? SYS_FS_ERROR : \
						((NULL == (_DATA = readdir(_DIR))) ? _DIR : _DIR) )
#undef  SYS_FS_READ
#define SYS_FS_READ(_DIR, _DATA)		(_DATA = readdir(_DIR))
#undef  SYS_FS_CLOSE
#define SYS_FS_CLOSE(_DIR)			closedir(_DIR)

#undef  SYS_FS_DATA_NAME
#define SYS_FS_DATA_NAME(_DATA, _strName)	_DATA->d_name
#undef  SYS_FS_DATA_SIZE
#define SYS_FS_DATA_SIZE(_DATA, _nSize)		_DATA->d_size
#undef  SYS_FS_DATA_ISKIND
#define SYS_FS_DATA_ISKIND(_DATA, _KIND)	((_DATA->d_type == _KIND) ? true : false)

#endif
